package com.example.concurrent.chapter03;

/**
 * @author Create By Liuqz
 * @date 2018/11/19 15:30
 */
public class ThreadSleep {

    public static void main(String[] args) {
        new Thread(() -> {
            long starTtime = System.currentTimeMillis();
            sleep(2_00L);
            long endTime = System.currentTimeMillis();
            System.out.println(String.format("Total speed %d ms", (endTime - starTtime)));
        }).start();


        long starTtime = System.currentTimeMillis();
        sleep(3_00L);
        long endTime = System.currentTimeMillis();
        System.out.println(String.format("Total speed %d ms", (endTime - starTtime)));
    }

    private static void sleep(long ms) {
        try {
            Thread.sleep(ms);
        } catch (InterruptedException e) {

        }
    }
}
